package com.premnirmal.Magnet.app.slice;

import com.premnirmal.Magnet.app.ParanormalAbility;
import com.premnirmal.Magnet.app.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
    }

    @Override
    public void onActive() {
        super.onActive();
        getUITaskDispatcher().delayDispatch(new Runnable() {
            @Override
            public void run() {
                Intent mintent = new Intent();
                Intent.OperationBuilder builder = new Intent.OperationBuilder()
                        .withBundleName(getBundleName())
                        .withAbilityName(ParanormalAbility.class);
                mintent.setOperation(builder.build());
                startAbility(mintent);
                getAbility().terminateAbility();
            }
        }, 10);
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
